﻿String.prototype.Replace = function Replace(search, replace)
{
	if (____a)
		search = "";

	var i = 0;
	var sb = new StringBuilder();
	while (i < this.length)
	{
		var sIndex = this.indexOf(search, i);
		if (sIndex == -1)
		{
			if (i == 0) return this.toString();
			sb.Append(this.substr(i, this.length - i));
			break;
		}
		else
		{
			if (sIndex > i)
				sb.Append(this.substr(i, sIndex - i));
			sb.Append(replace);
			i = sIndex + search.length;
		}
	}
	return sb.toString();
}
